function [PH,ax]=Plot_StackedBars(DecData,YNames,XNames,ColorList,ax)

%% Preliminary Setup
[Num_Group,Num_Bar] = size(DecData);
XVec = (1:1:Num_Bar)';
%% Positive and Negative Contribution
HD_Pos = max(DecData,0); HD_Neg = min(DecData,0);

if nargin<=3 || isempty(ColorList)
    ColorMap = [0,0,1;... 'b'
                1,0,0;... 'r'
                0,1,1;... 'c'
                1,0,1;... 'm'
                1,1,0;... 'y'
                0,1,0;... 'g'
                ];
    if Num_Group>size(ColorMap,1)
        Color_1 = [1,1,1]*0.5; Color_2 = [1,1,1]*0.9;
        TempNum = Num_Group-size(ColorMap,1);
        TempColorMap = zeros(TempNum,3);
        for ii=1:3
            TempColorMap(:,ii) = linspace(Color_1(ii),Color_2(ii),TempNum)';
        end
        ColorMap = [ColorMap;TempColorMap];
    end
    ColorList = num2cell(ColorMap,2);
end
if nargin<=4 || isempty(ax); ax = gca; end

%% Generate the Graph
TempBarPlot = @(HD) bar(ax,XVec,HD','stacked','barwidth',0.5,...
                        'Edgecolor','none','Linestyle','none');
% Positive Part
PH_1 = TempBarPlot(HD_Pos);
for ii=1:Num_Group; PH_1(ii).FaceColor = ColorList{ii}; end

% Negative Part
hold on
PH_1 = TempBarPlot(HD_Neg);
for ii=1:Num_Group; PH_1(ii).FaceColor = ColorList{ii}; end

% Total
hold on;
PH_2 = bar(ax,XVec,sum(DecData),'barwidth',0.6,'Edgecolor','k',...
           'Facecolor','none','Linewidth',2);
       
hold off;

PH = [PH_1,PH_2];

ax.YTick = PlotSetup_YTickValue([min(sum(HD_Neg));max(sum(HD_Pos))],0);
ax.XLim = [0.4,3.6]; ax.XTickLabel = XNames;
ax.XGrid = 'on'; ax.YGrid = 'on';
ax.FontSize = 8;

legend(PH,[YNames;{'Total'}],...
       'fontsize',8,'interpreter','latex',...
       'location','southoutside','NumColumns',2);
   
set(gca,'TickLabelInterpreter','latex')